|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectpow.AES
public class AES
implements AES encryption and decryption algorithms see @link http://java.sun.com/developer/technicalArticles/Security/AES/AES_v1.html see @link http://stackoverflow.com/questions/992019/java-256bit-aes-encryption
| Constructor Summary | |
|---|---|
AES()
construct a cipher with a generated 128 bits key |
|
AES(byte[] key,
byte[] iv)
construct a cipher from a key and a parameter array usefull to create a remote decryption cypher |
|
AES(java.lang.String password)
construct a cipher from an user specified key |
|
| Method Summary | |
|---|---|
byte[] |
decrypt(byte[] msg)
decrypt a byte array with AES algorithm see @link org.apache.commons.codec.binary.Hex to convert byte Array into hexString |
byte[] |
encrypt(byte[] msg)
encrypt a byte array with AES algorithm |
byte[] |
getKey()
get the cipher key |
byte[] |
getParamsEncrypt()
get the init parameter of the cipher object in order to initialyse correctly a remote cipher |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AES()
throws java.security.NoSuchAlgorithmException,
javax.crypto.NoSuchPaddingException,
java.security.InvalidKeyException,
java.security.spec.InvalidParameterSpecException,
java.security.InvalidAlgorithmParameterException
java.security.spec.InvalidParameterSpecException
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException
public AES(java.lang.String password)
throws java.security.NoSuchAlgorithmException,
javax.crypto.NoSuchPaddingException,
java.security.InvalidKeyException,
java.security.spec.InvalidParameterSpecException,
java.security.InvalidAlgorithmParameterException,
java.security.spec.InvalidKeySpecException
password - a string representing the user key
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException
java.security.InvalidKeyException
java.security.spec.InvalidParameterSpecException
java.security.InvalidAlgorithmParameterException
java.security.spec.InvalidKeySpecException
public AES(byte[] key,
byte[] iv)
throws java.security.InvalidKeyException,
java.security.InvalidAlgorithmParameterException,
java.security.NoSuchAlgorithmException,
javax.crypto.NoSuchPaddingException
key - the key in array byte formativ - parameter of the cipher
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
java.security.NoSuchAlgorithmException
javax.crypto.NoSuchPaddingException| Method Detail |
|---|
public byte[] getParamsEncrypt()
throws java.security.spec.InvalidParameterSpecException
java.security.spec.InvalidParameterSpecExceptionpublic byte[] getKey()
public byte[] encrypt(byte[] msg)
throws java.io.IOException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
msg -
java.io.IOException
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeExceptionto convert byte Array into hexString
public byte[] decrypt(byte[] msg)
throws java.io.IOException,
javax.crypto.IllegalBlockSizeException,
javax.crypto.BadPaddingException
msg - the msg to decrypt
java.io.IOException
javax.crypto.BadPaddingException
javax.crypto.IllegalBlockSizeException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||